package main

/**
 * @Description
 * @Author huran
 * @Date
 * @Param
 * @return
 **/
import (
	"net"
	"net/rpc"
)

type HelloService struct {
}

func (s *HelloService) Hello(request string, reply *string) error {
	*reply = "hello" + request
	return nil
}
func main() {
	listen, _ := net.Listen("tcp", ":1234")

	err := rpc.RegisterName("HelloService", &HelloService{})
	if err != nil {
		return
	}
	for {
		//新连接
		accept, _ := listen.Accept()
		go rpc.ServeConn(accept)
	}
}
